package com.s666.demo.common.response;

public class Result {
    /**
     * 成功响应结果
     *
     * @param data 内容
     * @return 响应结果
     */
    public static<T> ResultVO<T> succ(final T data) {
        ResultVO<T> resultVO = new ResultVO<T>();
        resultVO.setRspCode(ResultCode.SUCCEED_REQUEST.getValue());
        resultVO.setRspData(data);
        return resultVO;
    }

    /**
     * 成功响应结果
     *dev
     * @return 响应结果
     * @param
     */
    public static ResultVO succ() {
        return succ(null);
    }

    /**
     * 失败响应结果
     *
     * @param code    状态码
     * @param message 消息
     * @return 响应结果
     */
    public static ResultVO fail( String code,  String message) {
        ResultVO resultVO = new ResultVO();
        resultVO.setRspCode(code);
        return fail(code,message,null);
    }
    public static ResultVO fail( String code, String message, String data) {
        ResultVO<String> resultVO = new ResultVO<>();
        resultVO.setRspCode(code);
        resultVO.setRspData(data);
        resultVO.setRspMsg(message);
        return resultVO;
    }

}
